home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 14 / 014.d81 / t.sort collectio < prev    next >
Text File  |  2022-08-26  |  3KB  |  167 lines

  1.  
  2.           SORT COLLECTION
  3.  
  4.  
  5.  
  6. Written by:  Alan Gardner
  7.  
  8.  
  9.  
  10.   In the never ending search for the
  11.  
  12. most efficient way to spend our
  13.  
  14. computer's time, people have put much
  15.  
  16. study and effort into designing a
  17.  
  18. faster and more efficient sorting
  19.  
  20. method.  Some of the first sorts were
  21.  
  22. so slow that it could take days to
  23.  
  24. sort just a few hundred elements.
  25.  
  26. Due to the increase of knowledge in
  27.  
  28. the area of mathematical theory,
  29.  
  30. better sorting algorithms continually
  31.  
  32. arise.
  33.  
  34.   SORT COLLECTION presents three
  35.  
  36. of the more popular and more efficient
  37.  
  38. sorting methods.  Presented first is
  39.  
  40. a modified version of the insertion
  41.  
  42. sort.  The second is the famous Shell
  43.  
  44. Sort.  The third method presented is
  45.  
  46. a modification of the Shell Sort
  47.  
  48. called the Shell-Metzner.  Also
  49.  
  50. included in this program is an example
  51.  
  52. of a machine-language version of the
  53.  
  54. Shell-Metzner sort.
  55.  
  56.   When you run the program, you are
  57.  
  58. presented with a menu of the various
  59.  
  60. sorting methods.  After chosing a
  61.  
  62. method to sort with, a random array
  63.  
  64. of 100 characters is generated.  This
  65.  
  66. array is printed to the screen as the
  67.  
  68. 'BEFORE' array.  Next the program
  69.  
  70. begins to sort the 'BEFORE' array.
  71.  
  72. All of the sorts written in BASIC will
  73.  
  74. flash the border when an exchange is
  75.  
  76. made.  The machine-language sort does
  77.  
  78. NOT flash the border.  When the sort
  79.  
  80. is finished, the sorted characters
  81.  
  82. will be printed back to the screen
  83.  
  84. along with the time it took to sort
  85.  
  86. the array.
  87.  
  88.   Please feel free to use any of the
  89.  
  90. sorts presented in this program in
  91.  
  92. your own programs.  To use the
  93.  
  94. machine-language Shell-Metzner sort,
  95.  
  96. you must LOAD"SHELL-METZER.O",8,1.
  97.  
  98. To do this, simply put this line at
  99.  
  100. the beginning of your program:
  101.  
  102.  
  103. IFX=0THENX=1:LOAD"SHELL-METZNER.O",8,1
  104.  
  105.  
  106. To actually sort an array, use the
  107.  
  108. following SYS:
  109.  
  110.  
  111. 100 SYS49152 A$(0)
  112.  
  113.  
  114. The above line will sort the array
  115.  
  116. A$ in ascending order.  Be sure to use
  117.  
  118. element zero [ (0) ] when using this
  119.  
  120. SYS.  For example, if CG$ was
  121.  
  122. dimensioned to 1000 [DIM CG$(1000)]
  123.  
  124. and you wanted to sort it inside of
  125.  
  126. your program, then all you would need
  127.  
  128. is:
  129.  
  130.  
  131. 100 SYS49152 CG$(0)
  132.  
  133.  
  134.   *** NOTE ***
  135.  
  136.   The machine-language sort does NOT
  137.  
  138. take into account element zero when
  139.  
  140. sorting.  Therefore, if element zero
  141.  
  142. is equal to "Z", then after the sort
  143.  
  144. element zero will still be equal to
  145.  
  146. "Z".
  147.  
  148.   *** ANOTHER NOTE ***
  149.  
  150.   The source file for SHELL-METZNER
  151.  
  152. is included on this issue of LOADSTAR.
  153.  
  154. It is saved under the name of
  155.  
  156. "SHELL-METZNER.S".  It was written
  157.  
  158. with the MERLIN assembler.
  159.  
  160.  
  161.  
  162. >Files used: SORT COLLECTION
  163.              SHELL-METZNER.O
  164.              SHELL-METZNER.S -optional
  165.  
  166. --------------------------------------
  167.